package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
	"sync"
)

var token = `eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYXBpLWN1Y29lLnd1Zmx5LmNuXC9hcGlcL2xvZ2luIiwiaWF0IjoxNTg1NzIyMjEyLCJleHAiOjE1ODU4MDg2MTIsIm5iZiI6MTU4NTcyMjIxMiwianRpIjoiQUVnUHpQSFJBZHg2Nzc0cSIsInN1YiI6NTcwNzksInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.o418ItiYFvek6KMqPDq90Iw6a7rb_ySeUz4HzHGRSqU`

func main() {
	wg := sync.WaitGroup{}
	wg.Add(20)
	for i := 0; i < 10; i++ {
		go func() {
			client := &http.Client{}

			req, err := http.NewRequest("POST", "https://api-cucoe.wufly.cn/api/user/withdraw/action", strings.NewReader("money=5"))
			if err != nil {
				// handle error
			}

			req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
			req.Header.Set("Authorization", "Bearer "+token)

			resp, err := client.Do(req)
			if err != nil {
				fmt.Println(err)
			}

			defer resp.Body.Close()
			body, err := ioutil.ReadAll(resp.Body)
			if err != nil {
				// handle error
				fmt.Println(11, err)
			}

			fmt.Println(string(body))
			//time.Sleep(time.Second)
		}()
	}
	wg.Wait()
}
